<!DOCTYPE html>
<html lang="en">

<head>
	<meta charset="UTF-8">
	<meta name="viewport" content="width=device-width, initial-scale=1.0">
	<meta http-equiv="X-UA-Compatible" content="ie=edge">
	<title>Document</title>
	<style>
		b {
			color: red;
		}
	</style>
</head>

<body>
	<?php 
    // if(!file_exists("welcome.txt")) {
    //     die("文件不存在");
    // }else {
    //     $file = fopen("welcome.txt", "r");
    // }

    //错误处理函数
    function customError($errno, $errstr) {
        echo "<b>Error:</b> [$errno] $errstr <br>";
        echo "脚本结束";
        die();
    }
    //设置错误处理函数
    set_error_handler("customError");
    //触发错误
    $test = 2;
    if($test > 1) {
        trigger_error("变量的必须小于等于1", E_USER_WARNING);
    }
?>
</body>

</html>